<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title> Collections（集合）</title>
</head>
<body>
<p>

    each, map, reduce, reduceRight, find, filter, reject, all, any, include, invoke,pluck, max, min, sortBy, groupBy, sortedIndex, shuffle, toArray, size
</p>
<script src="underscore.js">
</script>
<script>
    //    _.each([1, 2, 3], alert);
    var str = _.map([1, 2, 3]);
    console.log(str);
    var arr = [1,2,3,20];
    var vol = _(arr).chain().each(function(item){ return item++; }).value();
    //    var vol = _(arr).chain().map(function(item){ return item++; }).value();
    console.log(vol);

    var evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
    console.log(evens);


    var invokes = _.invoke([[5, 1, 7], [3, 2, 1]], 'sort');
    console.log(invokes);
</script>
</body>
</html>